<?php
/**
 * Created by PhpStorm.
 * User: tsy
 * Date: 2016/7/8
 * Time: 16:33
 */
namespace Admin\Controller\Common;
use Think\Controller;

class CommonController extends Controller{
    /**
     * 证件类型
     */
    public function identity_type(){
        $common=D("Common");
        $result=$common->select_identity_type();
        echo json_encode($result);
    }

    /**
     * 贷款申请类型
     */
    public function loan_type(){
        $common=D("Common");
        $result=$common->select_loan_type();
        echo json_encode($result);
    }

    /**
     * 查询婚姻状况
     */
    public function marray_status(){
        $common=D("Common");
        $result=$common->select_marray_status();
        echo json_encode($result);
    }

    /**
     * 查询最高学历
     */
    public function education_status(){
        $common=D("Common");
        $result=$common->select_education_status();
        echo json_encode($result);
    }

    /**
     * 查询最高学位
     */
    public function degree_status(){
        $common=D("Common");
        $result=$common->select_degree_status();
        echo json_encode($result);
    }

    /**
     * 联系人关系
     */
    public function relation_status(){
        $common=D("Common");
        $result=$common->select_relation_status();
        echo json_encode($result);
    }

    /**
     * 查询职业
     */
    public function profession_status(){
        $common=D("Common");
        $result=$common->select_profession_status();
        echo json_encode($result);
    }

    /**
     * 查询行业
     */
    public function industry_status(){
        $common=D("Common");
        $result=$common->select_industry_status();
        echo json_encode($result);
    }

    /**
     * 查询职务
     */
    public function duty_status(){
        $common=D("Common");
        $result=$common->select_duty_status();
        echo json_encode($result);
    }

    /**
     * 查询职称
     */
    public function title_status(){
        $common=D("Common");
        $result=$common->select_title_status();
        echo json_encode($result);
    }

    /**
     * 查询居住状况
     */
    public function live_status(){
        $common=D("Common");
        $result=$common->select_live_status();
        echo json_encode($result);
    }

    public function current_status(){
        $common=D("Common");
        $result=$common->select_current_status();
        echo json_encode($result);
    }

    public function downfile()
    {
        $fileurl=I("get.url");
        ob_start();
        $filename=$fileurl;
        $index=strripos($fileurl, "/");
        $name=substr($fileurl,$index);
        $date=date("Ymd-H:i:m");
        header( "Content-type:  application/octet-stream ");
        header( "Accept-Ranges:  bytes ");
        header( "Content-Disposition:  attachment;  filename= {$name}");
        $size=readfile($filename);
        header( "Accept-Length: " .$size);
    }
}